import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

// state
let state = {
  loading: false,
  global: { // 公共数据
    user: {}
  }
}
// getters
const getters = {
  global: state => state.global
}

// actions
const actions = {}

// mutations
const mutations = {}

const store = new Vuex.Store({
  state,
  actions,
  getters,
  mutations,
  modules: {
    user
  },
  strict: false,
  debug: debug
})

export default store
